/// @tags: SegTreeMerge SegTreeSplit ODT
#include <cctype>
#include <cstdio>
#include <set>

namespace BlueQuantum {

int const N = 1e5 + 5, M = 6e6 + 5;

template <typename T>
inline T& read(T& x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

struct Node {
  int ls, rs, tot;
} tr[M];

int n, m, cnt, q, rt[N], op[N];
std::set<int> set;

void insert(int& x, int l, int r, int k) {
  tr[x = ++cnt].tot = 1;
  if (l == r) return;
  int mid = (l + r) >> 1;
  k <= mid ? insert(tr[x].ls, l, mid, k) : insert(tr[x].rs, mid + 1, r, k);
}

int query(int x, int l, int r) {
  if (l == r) return l;
  int mid = (l + r) >> 1;
  return tr[x].ls ? query(tr[x].ls, l, mid) : query(tr[x].rs, mid + 1, r);
}

void merge(int& x, int y) {
  if (!(x && y)) { return x |= y, void(); }
  tr[x].tot += tr[y].tot;
  merge(tr[x].ls, tr[y].ls);
  merge(tr[x].rs, tr[y].rs);
}

void split(int& x, int y, int k, int opt) {
  if (tr[y].tot == k) return;
  tr[x = ++cnt].tot = tr[y].tot - k;
  tr[y].tot = k;
  if (opt) {
    if (k <= tr[tr[y].rs].tot)
      split(tr[x].rs, tr[y].rs, k, opt), tr[x].ls = tr[y].ls, tr[y].ls = 0;
    else
      split(tr[x].ls, tr[y].ls, k - tr[tr[y].rs].tot, opt);
  } else {
    if (k <= tr[tr[y].ls].tot)
      split(tr[x].ls, tr[y].ls, k, opt), tr[x].rs = tr[y].rs, tr[y].rs = 0;
    else
      split(tr[x].rs, tr[y].rs, k - tr[tr[y].ls].tot, opt);
  }
}

inline std::set<int>::iterator split(int p) {
  std::set<int>::iterator i = set.lower_bound(p);
  if (*i == p) return i;
  --i;
  split(rt[p], rt[*i], p - *i, op[p] = op[*i]);
  return set.insert(p).first;
}

inline int main() {
  read(n), read(m);
  set.insert(n + 1);
  for (int i = 1, a; i <= n; ++i) read(a), insert(rt[i], 0, n, a), set.insert(i);
  for (int opt, l, r; m; --m) {
    read(opt), read(l), read(r);
    std::set<int>::iterator il = split(l), ir = split(r + 1);
    for (std::set<int>::iterator i = ++il; i != ir; ++i) merge(rt[l], rt[*i]);
    op[l] = opt;
    set.erase(il, ir);
  }
  read(q), split(q), split(q + 1);
  printf("%d", query(rt[q], 0, n));
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("TJOI2016]排序.in", "r", stdin);
  freopen("TJOI2016]排序.out", "w", stdout);
#endif
#endif

  return BlueQuantum::main();
}